home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Dema / betonsoldier_spdemo.exe / {app} / Shaders / mesh_toolkit_helper.fx < prev    next >
Encoding:
Text File  |  2005-05-05  |  5.8 KB  |  173 lines

  1. //------------------------------------------------------------------------------------------------------
  2. //------------------------------------------------------------------------------------------------------
  3. //------------------------------------------------------------------------------------------------------
  4.  
  5. #include "shared.fx"
  6. #include "lighting.fx"
  7. #define FOG_DISABLE // c'est mieux parce que sinon le gui il est fogguΘ et c'est pas terrible...
  8. #include "fog.fx"
  9.  
  10.  
  11. //------------------------------------------------------------------------------------------------------
  12. //- Static parameters
  13. //------------------------------------------------------------------------------------------------------
  14.  
  15. texture            DiffuseMap;
  16. float4            Color;
  17.  
  18. //------------------------------------------------------------------------------------------------------
  19. //------------------------------------------------------------------------------------------------------
  20. //------------------------------------------------------------------------------------------------------
  21.  
  22. struct    CVertexShaderInput
  23. {
  24.     float4    Position    :    POSITION;
  25.     float2    DiffuseUv    :    TEXCOORD0;    
  26. };
  27.  
  28. //------------------------------------------------------------------------------------------------------
  29.  
  30. struct    CVertexShaderOutput
  31. {
  32.     float4    Position            :    POSITION;
  33.     float2    DiffuseUv            :    TEXCOORD0;    
  34.     FOG_OPTION_VERTEX_FIELD
  35. };
  36.  
  37. //------------------------------------------------------------------------------------------------------
  38. //------------------------------------------------------------------------------------------------------
  39. //------------------------------------------------------------------------------------------------------
  40.  
  41. CVertexShaderOutput    OpaSelfIllumGeomTech1Pass1            (const CVertexShaderInput input);
  42.  
  43. //------------------------------------------------------------------------------------------------------
  44. //------------------------------------------------------------------------------------------------------
  45. //------------------------------------------------------------------------------------------------------
  46.  
  47. CVertexShaderOutput    OpaSelfIllumGeomTech1Pass1 (const CVertexShaderInput input)
  48. {
  49.     CVertexShaderOutput output;
  50.     
  51.     // output position into world+view+projection space
  52.     output.Position = mul (input.Position,WorldCameraProjection);
  53.         
  54.     // Diffuse Uv output
  55.     output.DiffuseUv = input.DiffuseUv;
  56.         
  57.     // fog computation
  58.     FOG_OPTION_COMPUTE(output, output.Position);
  59.             
  60.     return output;
  61. }
  62.  
  63. //------------------------------------------------------------------------------------------------------
  64. //------------------------------------------------------------------------------------------------------
  65. //------------------------------------------------------------------------------------------------------
  66.  
  67. #define RenderStates \
  68.     Texture[0]        = <DiffuseMap>; \
  69.     MinFilter[0]        = LINEAR; \
  70.     MagFilter[0]        = LINEAR; \
  71.     MipFilter[0]        = LINEAR; \
  72.     AddressU[0]        = WRAP; \
  73.     AddressV[0]        = WRAP; \
  74.     CullMode            = CW; \
  75.     ZEnable            = true; \
  76.     ZFunc            = LESSEQUAL; \
  77.     ZWriteEnable        = true; \
  78.     AlphaBlendEnable    = false; \
  79.     AlphaTestEnable        = true; \
  80.     AlphaRef            = 192; \
  81.     AlphaFunc            = GREATEREQUAL ; \
  82.     FOG_OPTION_PARAMETERS
  83.     
  84. //------------------------------------------------------------------------------------------------------
  85. //------------------------------------------------------------------------------------------------------
  86. //------------------------------------------------------------------------------------------------------
  87.  
  88. technique    tech1
  89. <
  90.     int Priority = 1;
  91.     int TechniqueIndex = 0;
  92.     int DeviceType = HWSHADER_ONLY;
  93.     int LightingType = INTEGRATED_LIGHTING;
  94.     string RenderingType = "Standard";
  95. >
  96. {
  97.     pass pass1
  98.     {
  99.         RenderStates;
  100.  
  101.         VertexShader = compile vs_1_1 OpaSelfIllumGeomTech1Pass1();
  102.         
  103.         PixelShaderConstant[0] = <Color>;
  104.         PixelShader = 
  105.         asm
  106.         {
  107.             ps_1_1
  108.             
  109.             tex        t0    // Diffuse map
  110.             
  111.             mul r0,t0,c0
  112.         };
  113.     }
  114. }
  115.  
  116. //------------------------------------------------------------------------------------------------------
  117. //------------------------------------------------------------------------------------------------------
  118. //------------------------------------------------------------------------------------------------------
  119.  
  120. technique    techTnL_0
  121. <
  122.     int Priority = 1;
  123.     int TechniqueIndex = 0;
  124.     int DeviceType = TNL_ONLY;
  125.     int LightingType = INTEGRATED_LIGHTING;
  126.     string RenderingType = "Standard";
  127. >
  128. {
  129.     pass pass1
  130.     {
  131.         WorldTransform[0]    = <WorldCameraProjection>;
  132.         
  133.         Texture[0]            = <DiffuseMap>;
  134.         
  135.         ColorArg1[0]        = TEXTURE;
  136.         ColorOp[0]        = SELECTARG1;
  137.         AlphaArg1[0]        = TEXTURE;
  138.         AlphaOp[0]        = SELECTARG1;
  139.         
  140.         ColorOp[1]        = DISABLE;
  141.         AlphaOp[1]        = DISABLE;
  142.         
  143.         MinFilter[0]        = LINEAR;
  144.         MagFilter[0]        = LINEAR;
  145.         MipFilter[0]        = LINEAR;
  146.         
  147.         AddressU[0]            = WRAP;
  148.                 AddressV[0]            = WRAP;
  149.         
  150.         CullMode            = CW;
  151.         ZEnable                = true;
  152.         ZFunc                = LESSEQUAL;
  153.         ZWriteEnable        = true;
  154.         AlphaBlendEnable    = false;
  155.         AlphaTestEnable        = true;
  156.         AlphaRef            = 192;
  157.         AlphaFunc            = GREATEREQUAL;
  158.         
  159.         VertexShader         = NULL;        
  160.         PixelShader         = NULL;
  161.     }
  162. }
  163.  
  164. //------------------------------------------------------------------------------------------------------
  165. //------------------------------------------------------------------------------------------------------
  166. //------------------------------------------------------------------------------------------------------
  167.  
  168. #include "mesh_shadow.fx"
  169. #include "mesh_shadow_projector.fx"
  170.  
  171. //------------------------------------------------------------------------------------------------------
  172. //------------------------------------------------------------------------------------------------------
  173. //------------------------------------------------------------------------------------------------------